#pragma once

#include "MGUI_Widget.h"
#include "MGUI_TextBox.h"

namespace Myway {

	class MGUI_ENTRY MGUI_ImageButton : public MGUI_Widget
	{
		DeclareRTTI();

	public:
		MGUI_ImageButton(const MGUI_LookFeel * _lookfeel, MGUI_Widget * _parent);
		virtual ~MGUI_ImageButton();

		void SetCaption(const MGUI_String & caption);
		const MGUI_String & GetCaption();

		void SetFont(MGUI_Font * font);
		MGUI_Font * GetFont();

		void SetSkin(int state, TexturePtr _skin, const MGUI_RectF & _rect = MGUI_RectF(0, 0, 1, 1));

		void SetSkin(int state, const TString128 & _skin);
		void SetUVRect(int state, const MGUI_RectF & _rect);

		TexturePtr GetSkin(int state) { return mSkin[state]; }
		const MGUI_RectF & GetUVRect(int state) { return mUVRect[state]; }

		virtual void UpdateRenderItem(MGUI_Layout * _layout);

	protected:
		bool mMousePressed;
		MGUI_TextBox * mTextBox;

		tFixedArray<TexturePtr, MGUI_WidgetState::Max> mSkin;
		tFixedArray<MGUI_RectF, MGUI_WidgetState::Max> mUVRect;
	};

}